package com.fsnbigdata.repository;
import com.fsnbigdata.domain.EndangeredSpeciesImage;
import org.springframework.data.jpa.repository.Query;
import org.springframework.roo.addon.layers.repository.jpa.annotations.RooJpaRepository;
import com.fsnbigdata.domain.EndangeredSpecies;
import io.springlets.data.jpa.repository.DetachableJpaRepository;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;

/**
 * = EndangeredSpeciesImageRepository
 *
 * TODO Auto-generated class documentation
 *
 */
@RooJpaRepository(entity = EndangeredSpeciesImage.class)
@Transactional(readOnly = true)
public interface EndangeredSpeciesImageRepository extends DetachableJpaRepository<EndangeredSpeciesImage, Long>, EndangeredSpeciesImageRepositoryCustom {

    /**
     * TODO Auto-generated method documentation
     *
     * @param endangeredSpecies
     * @return Long
     */
    public abstract long countByEndangeredSpecies(EndangeredSpecies endangeredSpecies);

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return EndangeredSpeciesImage
     */
    public abstract EndangeredSpeciesImage findOne(Long id);

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return List
     */
    public abstract List<EndangeredSpeciesImage> findAll(Iterable<Long> id);

    /**
     * TODO Auto-generated method documentation
     *
     * @param endangeredSpeciesImage
     * @return EndangeredSpeciesImage
     */
    public abstract EndangeredSpeciesImage save(EndangeredSpeciesImage endangeredSpeciesImage);

    @Query(value = "select url from endangered_species_image where endangered_species_id = ?1",nativeQuery = true)
    public List<String> getUrl(String id);
}
